<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    437. Path Sum III
   </h1>
   <p>
    You are given a binary tree in which each node contains an integer value.
   </p>
   <p>
    Find the number of paths that sum to a given value.
   </p>
   <p>
    The path does not need to start or end at the root or a leaf, but it must go downwards
(traveling only from parent nodes to child nodes).
   </p>
   <p>
    The tree has no more than 1,000 nodes and the values are in the range -1,000,000 to 1,000,000.
   </p>
   <p>
    <b>
     Example:
    </b>
   </p>
   <pre>
root = [10,5,-3,3,2,null,11,3,-2,null,1], sum = 8

      10
     /  \
    <b>5</b>   <b>-3</b>
   <b>/</b> <b>\</b>    <b>\</b>
  <b>3</b>   <b>2</b>   <b>11</b>
 / \   <b>\</b>
3  -2   <b>1</b>

Return 3. The paths that sum to 8 are:

1.  5 -&gt; 3
2.  5 -&gt; 2 -&gt; 1
3. -3 -&gt; 11
</pre>
  </div>
  <div>
   <h1 class="question_title">
    437. 路径总和 III
   </h1>
   <p>
    给定一个二叉树，它的每个结点都存放着一个整数值。
   </p>
   <p>
    找出路径和等于给定数值的路径总数。
   </p>
   <p>
    路径不需要从根节点开始，也不需要在叶子节点结束，但是路径方向必须是向下的（只能从父节点到子节点）。
   </p>
   <p>
    二叉树不超过1000个节点，且节点数值范围是 [-1000000,1000000] 的整数。
   </p>
   <p>
    <strong>
     示例：
    </strong>
   </p>
   <pre>root = [10,5,-3,3,2,null,11,3,-2,null,1], sum = 8

      10
     /  \
    <strong>5</strong>   <strong>-3</strong>
   <strong>/</strong> <strong>\</strong>    <strong>\</strong>
  <strong>3</strong>   <strong>2</strong>   <strong>11</strong>
 / \   <strong>\</strong>
3  -2   <strong>1</strong>

返回 3。和等于 8 的路径有:

1.  5 -&gt; 3
2.  5 -&gt; 2 -&gt; 1
3.  -3 -&gt; 11
</pre>
  </div>
 </body>
</html>